<!-- 项目存档申请 -->
<template>
  <view>
    <u-form
      :model="model"
      :rules="rules"
      ref="form"
      labelPosition="top"
      labelWidth="auto"
      :labelStyle="{
        fontSize: '14px',
        color: '#B2B2B2',
        lineHight: '20px',
      }"
    >
      <view class="basic-style">
        <view class="basic-title basic-border">基本信息</view>
        <u-form-item label="单据编号" prop="billNo" required>
          <u--input v-model="model.billNo" disabled></u--input>
        </u-form-item>
        <u-form-item label="申请时间" prop="createTime" required>
          <u--input v-model="model.createTime" disabled></u--input>
        </u-form-item>
        <u-form-item label="申请人" prop="proposer" required>
          <h-select-person-input
            style="width: 100%"
            disabled
            v-model="model.proposer"
            placeholder="请选择申请人"
            border="surround"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
            objectField="model.proposer"
          ></h-select-person-input>
        </u-form-item>
        <u-form-item label="申请人部门" prop="proposerDeptId" required>
          <h-select-depart-input
            disabled
            v-model="model.proposerDeptId"
            :departName="model.proposerDeptIdText"
            placeholder="请选择部门"
            border="surround"
            style="width: 100%"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
            :title.sync="model.proposerDeptIdText"
          ></h-select-depart-input>
        </u-form-item>
      </view>

      <view class="basic-style">
        <view class="basic-title basic-border pt-1">项目信息</view>
        <u-form-item label="项目名称" prop="projectId" required>
          <h-select-project-input-popup
            disabled
            :proDisabled="true"
            :projectStatus="'2'"
            ref="projectSelect"
            v-model="model.projectId"
            style="width: 100%"
            placeholder="请选择项目名称"
            border="surround"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
            @change="onChangeProjectName"
          ></h-select-project-input-popup>
        </u-form-item>
        <u-form-item label="项目编号" prop="projectNo">
          <u--input disabled placeholder="请输入项目编号" v-model="model.projectNo"></u--input>
        </u-form-item>
        <u-form-item label="签订单位" prop="signUnit">
          <h-select-company-input-popup
            disabled
            style="width: 100%"
            v-model="model.signUnit"
            commercialType="1"
            placeholder="请选择签订单位"
            border="surround"
          ></h-select-company-input-popup>
        </u-form-item>
        <u-form-item label="经营团队" prop="managementTeam">
          <h-select-team-input
            disabled
            style="width: 100%"
            v-model="model.managementTeam"
            objectField="model.managementTeam"
            placeholder="请选择经营团队"
            border="surround"
            :tdlx="1"
          />
        </u-form-item>
        <u-form-item label="项目承接人" prop="undertaker">
          <h-select-person-input-popup
            disabled
            v-model="model.undertaker"
            style="width: 100%"
            placeholder="请选择项目承接人"
            searchPlaceholder="请输入"
            border="surround"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
          ></h-select-person-input-popup>
        </u-form-item>
        <u-form-item label="项目地址" prop="area" :borderBottom="false">
          <h-select-address-input
            disabled
            style="width: 100%"
            v-model="model.area"
            placeholder="请选择项目地址"
            border="surround"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
          ></h-select-address-input>
        </u-form-item>
				<u-form-item label="项目详细地址" prop="projectAddress" :borderBottom="false">
				  <u--input v-model="model.projectAddress" disabled placeholder="请输入项目详细地址" border="surround"></u--input>
				</u-form-item>
        <u-form-item label="业务名称" prop="businessName" required>
          <h-select-task-input-popup
            disabled
            :projectId="model.projectId"
            v-model="model.businessName"
            class="w-100"
            :placeholder="model.projectId ? '请选择业务名称' : '请先选择项目'"
            searchPlaceholder="请输入业务名称"
            border="surround"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
            @change="onTaskIdInput"
            :customParams="{
              //   changeStatus: '!changing',
              distributionType: 'finish',
            }"
            @select="model.taskDescription = $event.data.taskDescription"
          ></h-select-task-input-popup>
        </u-form-item>
        <u-form-item label="任务编号" prop="taskNo" :borderBottom="false">
          <u--input v-model="model.taskNo" disabled placeholder="请输入任务编号" border="surround"></u--input>
        </u-form-item>
        <u-form-item label="实施部门" prop="implementationDepartment" :borderBottom="false">
          <h-select-depart-input
            v-model="model.implementationDepartment"
            :departName="model.implementationDepartmentText"
            placeholder="请选择部门"
            disabled
            border="surround"
            style="width: 100%"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
            :title.sync="model.implementationDepartmentText"
            @detail="onExecuteDepartInput"
          ></h-select-depart-input>
        </u-form-item>
        <u-form-item label="生产团队" prop="productionTeam" :borderBottom="false">
          <h-select-team-input
            style="width: 100%"
            disabled
            v-model="model.productionTeam"
            objectField="model.productionTeam"
            placeholder="请选择生产团队"
            border="surround"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
            :tdlx="2"
          ></h-select-team-input>
        </u-form-item>
        <u-form-item label="项目负责人" prop="projectLeader" :borderBottom="false">
          <h-select-person-input
            style="width: 100%"
            disabled
            v-model="model.projectLeader"
            placeholder="请选择项目负责人"
            border="surround"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
            objectField="model.projectLeader"
          ></h-select-person-input>
        </u-form-item>
        <u-form-item label="行业类别" prop="industryCategory" :borderBottom="false">
          <h-dict-select
            style="width: 100%"
            disabled
            v-model="model.industryCategory"
            placeholder="请选择行业类别"
            dictName="industry_category"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
          ></h-dict-select>
        </u-form-item>
        <u-form-item label="审批级别" prop="approvalLevel" :borderBottom="false">
          <h-dict-select
            style="width: 100%"
            disabled
            v-model="model.approvalLevel"
            placeholder="请选择审批级别"
            dictName="approval_level"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
          ></h-dict-select>
        </u-form-item>

        <u-form-item label="审批机构" prop="approvalAuthority">
          <u--input disabled placeholder="请输入审批机构" v-model="model.approvalAuthority"></u--input>
        </u-form-item>
        <u-form-item label="投资额（元）" prop="investmentAmount">
          <h-money-input disabled placeholder="请输入投资额（元）" v-model="model.investmentAmount"></h-money-input>
        </u-form-item>
        <u-form-item label="规模" prop="scale">
          <u--input disabled placeholder="请输入规模" v-model="model.scale"></u--input>
        </u-form-item>
        <u-form-item label="批复文号" prop="approvalDocumentNo">
          <u--input disabled placeholder="请输入批复文号" v-model="model.approvalDocumentNo"></u--input>
        </u-form-item>
        <u-form-item label="批复日期" prop="approvalDate">
          <h-time-select
            disabled
            v-model="model.approvalDate"
            placeholder="请选择批复日期"
            border="surround"
            suffixIcon="calendar-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
          ></h-time-select>
        </u-form-item>

        <u-form-item label="档案大类" prop="archiveMajorCategory" required>
          <h-dropdown
            class="w-100"
            keyName="title"
            placeholder="请选择"
            :api="api.queryProvisionBroadList"
            v-model="model.archiveMajorCategory"
            :params="{ pcode: 'A04', async: true, removeCode: 'A04A02,A04A01' }"
            dataKey="result"
            valName="code"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
            @change="docBigCategoryChange"
          />
        </u-form-item>
        <u-form-item label="档案小类" prop="archiveMinorCategory" required>
          <h-dropdown
            class="w-100"
            keyName="title"
            ref="provisionSmall"
            placeholder="请选择"
            :disabled="!model.archiveMajorCategory"
            :api="api.queryProvisionBroadList"
            v-model="model.archiveMinorCategory"
            :params="{ pcode: model.archiveMajorCategory, async: true, removeCode: '' }"
            dataKey="result"
            valName="code"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
            @change="docSmallCategoryChange"
          />
        </u-form-item>
        <u-form-item label="档案所属团队" prop="archiveBelongingTeam" required>
          <h-select-team-input
            style="width: 100%"
            v-model="model.archiveBelongingTeam"
            objectField="model.archiveBelongingTeam"
            placeholder="请选择档案所属团队"
            border="surround"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
            :tdlx="2"
          ></h-select-team-input>
        </u-form-item>
        <u-form-item label="密级" prop="secrecyLevel" required>
          <h-select-input-tag
            class="w-100"
            v-model="model.secrecyLevel"
            objectField="model.secrecyLevel"
            placeholder="请选择密级"
            border="surround"
            dictName="secrecy_level"
          ></h-select-input-tag>
        </u-form-item>
      </view>

      <view class="basic-style">
        <view class="basic-title basic-border">存档信息</view>
        <template v-if="formData && formData.length">
          <view class="inforamtion" style="display: flex" v-for="(item, index) in formData" :key="index">
            <view>
              <view class="option" style="width: 520rpx">
                <view class="lf">档案名称</view>
                <view class="rl">{{ item.archiveName }}</view>
              </view>
              <view class="option" style="width: 520rpx">
                <view class="lf">纸质版数量</view>
                <view class="rl">{{ item.paperVersionQuantity }}</view>
              </view>
              <view class="option" style="width: 520rpx">
                <view class="lf">是否有电子版</view>
                <view class="rl">{{ item.isElectronicVersion }}</view>
              </view>
              <view class="option" style="width: 520rpx">
                <view class="lf">备注</view>
                <view class="rl">{{ item.remark }}</view>
              </view>
            </view>
          </view>
        </template>
        <view v-else>
          <u-empty mode="data" icon="/static/empty/data.png"></u-empty>
        </view>
      </view>

      <view class="basic-style">
        <view class="basic-title basic-border">任务附件</view>
        <view class="py-1 space-y-1" style="width: 100%">
					<h-upload-file v-model="model.attachments" :isIcon="false"></h-upload-file>
          <file-list v-if="model.attachments" v-model="model.attachments" :isDelete="true"></file-list>
        </view>
      </view>

      <!-- <view class="" style="padding: 20rpx; display: flex">
        <u-button style="margin-right: 20rpx" type="primary" text="提交" @click="onSubmit"></u-button>
        <u-button type="primary" text="审核" @click="onAudit"></u-button>
      </view> -->
			<view class="space-x-1 px-1 btn_position">
				<backButton  @onSubmit="onSubmit" :nodeObj="nodeObj" :model="modelForm" :resultObj="resultObj"></backButton>
			</view>
			<view style="height: 100rpx;"></view>
      <u-toast ref="uToast"></u-toast>
      <ProcessNodeConfiguration ref="processConfig" @ok="onOk"></ProcessNodeConfiguration>
    </u-form>
  </view>
</template>
  
  <script>
import { mapState } from 'vuex'
import moment from 'moment'
import { gainBillNo, add, edit, info, allListNoPage } from '@/api/project/erpProjectArchiveForm'
import { queryProvisionBroadList } from '@/api/work/ErpOaDocReferenceBillForm'
import { filterMultiDictText, initDictOptions } from '@/utils/JDictSelectUtil.js'
import fileList from '@/pages/synergy/components/fileList.vue'
import projectArchiveForm from '../project/components/projectArchiveForm.vue'
import FormInfo from '../project/components/projectArchiveFormInfo.vue'
import ProcessNodeConfiguration from '@/components/ProcessNodeConfiguration/ProcessNodeConfiguration.vue' // 流程节点配置人员选择弹窗
import backButton from '@/components/backButton'
import {
	getProcessTaskTransInfo // 流程流转
} from '@/api/index.js'
export default {
  name: 'ErpProjectArchiveFormBack',
  components: {
    fileList,
    projectArchiveForm,
    FormInfo,
    ProcessNodeConfiguration,
		backButton
  },
  data() {
    return {
      modelForm: '',
      isSubmit: false, // 控制按钮是否可以点击
      index: null,
      showFormModal: false,
      loading: false,
      id: '',
      tabvalue: '',
      nodeObj: {},
      basicForm: {},
      dictOptions: {},
      formData: [],
      api: {
        queryProvisionBroadList,
      },
      model: {
        bpmBizTitle: '',
        billNo: '',
        createTime: '',
        proposer: '',
        proposerDeptId: '',
        projectId: '',
        projectNo: '',
        signUnit: '',
        undertaker: '',
        projectAddress: '',
        businessName: '',
        taskNo: '',
        implementationDepartment: '',
        productionTeam: '',
        projectLeader: '',
        industryCategory: '',
        approvalLevel: '',
        approvalAuthority: '',
        investmentAmount: '',
        scale: '',
        approvalDocumentNo: '',
        approvalDate: '',
        archiveMajorCategory: '',
        archiveMinorCategory: '',
        archiveBelongingTeam: '',
        secrecyLevel: '',
        attachments: null,
      },
      rules: {
				billNo: [{ required: true, message: '请输入单据编号!', trigger: ['blur', 'change'] }],
				proposerDeptId: [{ required: true, message: '请选择申请部门!', trigger: ['blur', 'change'] }],
				proposer: [{ required: true, message: '请选择申请人!', trigger: ['blur', 'change'] }],
				createTime: [{ required: true, message: '请选择申请时间!', trigger: ['blur', 'change'] }],

        projectId: [{ required: true, message: '请选择项目名称!' }],
        businessName: [{ required: true, message: '请选择业务名称!' }],
        archiveMajorCategory: [{ required: true, message: '请选择档案大类!' }],
        archiveMinorCategory: [{ required: true, message: '请选择档案小类!' }],
        archiveBelongingTeam: [{ required: true, message: '请选择档案所属团队!' }],
        secrecyLevel: [{ required: true, message: '请选择密级!' }],
      },
      projectIdBackups: null,
			resultObj: {}
    }
  },
  onReady() {
    uni.setNavigationBarTitle({
      title: this.modelForm.bpmBizTitle.replace(/(【|】)/g, ''),
    })
  },
  onLoad(options) {
    this.modelForm = JSON.parse(decodeURIComponent(options.item))
    // this.initDictConfig()
    var that = this
    // #ifdef APP-NVUE
    var eventChannel = this.$scope.eventChannel // 兼容APP-NVUE
    // #endif
    // #ifndef APP-NVUE
    var eventChannel = this.getOpenerEventChannel()
    // #endif
    // 监听sendMessage事件，获取上一页面通过eventChannel传送到当前页面的数据
    eventChannel.on('sendMessage', function (data) {
      that.tabvalue = data.tabvalue
      that.nodeObj = JSON.parse(decodeURIComponent(data.nodeObj))
      that.id = that.nodeObj.dataId
      that.loadData(that.nodeObj.dataId)
			that.initDataList()
			that.getProcessTaskTrans(that.modelForm.id)
    })
  },
  computed: {
    ...mapState(['userInfo']),
  },
  methods: {
		// 查询流程流转信息 -- 获取下一节点信息
		getProcessTaskTrans(taskId){
			getProcessTaskTransInfo({ taskId }).then(res => {
				if(res.success){
					this.resultObj = res.result
				} else {
					this.$refs.uToast.show({
						message: res.message,
						type: 'error'
					})
				}
			}).catch(err => {
				console.log(err);
			})
		},
    // 提交流程成功
    onOk() {
      this.$refs.uToast.show({
        message: '提交成功',
        type: 'success',
        complete() {
          if (getCurrentPages().length > 1) {
            uni.navigateBack()
          } else {
            uni.reLaunch({
              url: '/pages/home/home',
            })
          }
        },
      })
    },
    loadData(id) {
      info({ id }).then((res) => {
        if (res.success) {
          this.model = res.result
          this.docSmallCategoryLoadData()
        } else {
          this.$refs.uToast.show({
            message: res.message,
            type: 'error',
          })
        }
      })
    },
    docSmallCategoryLoadData() {
      // $nextTick 解决大类修改后小类接口 params 未更新的问题
      this.$nextTick(() => {
        this.$refs.provisionSmall.loadData()
      })
    },
    docBigCategoryChange(docCategoryCode) {
      this.$set(this.model, 'archiveMajorCategory', docCategoryCode) // 档案编码
      this.docSmallCategoryLoadData()
    },
    docSmallCategoryChange(docCategoryCode) {
      this.$set(this.model, 'archiveMinorCategory', docCategoryCode) // 档案编码
    },
    //清除所有带出数据
    resetData() {
      //带出项目编号
      this.$set(this.model, 'projectNo', null)

      //带出项目真实名称
      this.$set(this.model, 'projectName', null)

      //带出签订单位
      this.$set(this.model, 'signUnit', null)

      //带出项目承接人
      this.$set(this.model, 'undertaker', null)

      //带出经营团队
      this.$set(this.model, 'managementTeam', null)

      //带出项目地址
      this.$set(this.model, 'areaCode', null)

      //带出项目地址
      this.$set(this.model, 'projectAddress', null)

      //清除业务分类
      this.$set(this.model, 'businessName', null)

      //带出任务编号
      this.$set(this.model, 'taskNo', null)

      //带出实施部门
      this.$set(this.model, 'implementationDepartment', null)

      //带出生产团队
      this.$set(this.model, 'productionTeam', null)

      //带出项目负责人
      this.$set(this.model, 'projectLeader', null)

      //带出行业类别
      this.$set(this.model, 'industryCategory', null)

      //带出审批级别
      this.$set(this.model, 'approvalLevel', null)
    },
    // 选择项目名称
    async onChangeProjectName(event) {
      let backItem = event
      if (!event) {
        this.projectIdBackups = null
        //带出项目编号
        this.$set(this.model, 'projectNo', undefined)

        //带出项目真实名称
        this.$set(this.model, 'projectName', undefined)

        //带出签订单位
        this.$set(this.model, 'signUnit', undefined)

        //带出项目承接人
        this.$set(this.model, 'undertaker', undefined)

        //带出经营团队
        this.$set(this.model, 'managementTeam', undefined)

        //带出项目地址
        this.$set(this.model, 'area', undefined)

        //带出项目地址
        this.$set(this.model, 'projectAddress', undefined)
        return false
      }

      if (!this.model.id && !this.projectIdBackups) {
        this.projectIdBackups = this.model.projectId
        //带出项目编号
        this.$set(this.model, 'projectNo', event.finalNo)

        //带出项目真实名称
        this.$set(this.model, 'projectName', event.projectName)

        //带出签订单位
        this.$set(this.model, 'signUnit', event.signUnit)

        //带出项目承接人
        this.$set(this.model, 'undertaker', event.undertaker)

        //带出经营团队
				this.$set(this.model, 'managementTeam', event.oldTeamId ? event.oldTeamId : event.teamName)

        //带出项目地址
        this.$set(this.model, 'area', event.areaCode)

        //带出项目地址
        this.$set(this.model, 'projectAddress', event.projectAddress)
      }
      //切换项目清空子表弹窗提示
      if (this.projectIdBackups && this.projectIdBackups !== backItem.id) {
        const that = this

        uni.showModal({
          title: '确认切换项目',
          content: '切换项目会清空所有任务相关信息，您确定要切换吗？',
          success: (res) => {
            if (res.confirm) {
              //确认后进行改变
              that.projectIdBackups = that.model.projectId

              //清空所有带出数据
              that.resetData()

              //带出项目编号
              that.$set(that.model, 'projectNo', backItem.finalNo)

              //带出项目真实名称
              that.$set(that.model, 'projectName', backItem.projectName)

              //带出签订单位
              that.$set(that.model, 'signUnit', backItem.signUnit)

              //带出项目承接人
              that.$set(that.model, 'undertaker', backItem.undertaker)

              //带出经营团队
              that.$set(that.model, 'managementTeam', backItem.oldTeamId ? backItem.oldTeamId : backItem.teamName)

              //带出项目地址
              that.$set(that.model, 'areaCode', backItem.areaCode)

              //带出项目地址
              that.$set(that.model, 'projectAddress', backItem.projectAddress)
            } else if (res.cancel) {
              that.model.projectId = that.projectIdBackups
            }
          },
        })
      }
    },

    // 选择任务编号
    onTaskIdInput({ data: event }) {
      if (!event) {
        //带出任务编号
        this.$set(this.model, 'taskNo', undefined)

        //带出实施部门
        this.$set(this.model, 'implementationDepartment', undefined)

        //带出生产团队
        this.$set(this.model, 'productionTeam', undefined)

        //带出项目负责人
        this.$set(this.model, 'projectLeader', undefined)

        //带出行业类别
        this.$set(this.model, 'industryCategory', undefined)

        //带出审批级别
        this.$set(this.model, 'approvalLevel', undefined)
        return false
      }
      //带出任务编号
      this.$set(this.model, 'taskNo', event.billNo)
      //带出实施部门
      this.$set(this.model, 'implementationDepartment', event.executeDepart)
      //带出生产团队
      this.$set(this.model, 'productionTeam', event.productTeam)
      //带出项目负责人
      this.$set(this.model, 'projectLeader', event.projectLeading)
      //带出行业类别
      this.$set(this.model, 'industryCategory', event.industryCategory)
      //带出审批级别
      this.$set(this.model, 'approvalLevel', event.approvalLevel)
    },

    // 选择实施部门
    onExecuteDepartInput(item) {},
    initDictConfig() {
      initDictOptions('erp_omc_project_task,category_name,id').then((res) => {
        if (res.success) {
          this.$set(this.dictOptions, 'businessName', res.result)
        }
      })
      initDictOptions('erp_omc_project,project_name,id').then((res) => {
        if (res.success) {
          this.$set(this.dictOptions, 'projectId', res.result)
        }
      })
    },
    handleCopyForm([item, index]) {
      this.formData.push({
        ...item,
      })
      this.$u.toast('复制成功')
    },
    handleEditForm([item, index]) {
      this.basicForm = { ...item }
      this.index = index
      this.showFormModal = true
    },
    handleRemoveForm(item) {
      this.formData = this.formData.filter((i) => i !== item)
    },
    closeFormModal() {
      this.$refs.dataForm.reset()
      this.basicForm = {}
      this.index = null
    },
    openFormModal() {
      this.$refs.dataForm.basicForm = this.basicForm
    },
    addForm() {
      this.index = null
      this.showFormModal = true
    },
    // 新增物料
    handleAddMember() {
      this.index = null
      this.showFormModal = true
    },
    /**
     * 子表单新增点击确认
     */
    handleFormSubmit([data, index]) {
      this.showFormModal = false
      if (typeof index === 'number') {
        this.$set(this.formData, index, data)
      } else {
        this.formData.push(data)
      }
      // this.initBuyerInfo()
    },
    // 获取单据编号
    async initBillNo() {
      const res = await gainBillNo({})
      this.model.billNo = res.result
    },
    // 初始化新增需要的数据
    initForm() {
      this.model.proposer = this.userInfo.empId //当前登录人
      this.model.proposerDeptId = this.userInfo.deptId //当前登录人部门
      this.model.createTime = moment().format('YYYY-MM-DD HH:mm:ss')
    },
    async initInfo() {
      const response = await info({ id: this.id })
      const data = response?.result || {}
      this.model = Object.assign({}, data)
    },
    async initDataList() {
      const response = await allListNoPage({ mainId: this.id })
      const data = response.success ? response.result : []
      this.formData = data
    },
    validateForm() {
      return this.$refs.form.validate().then(async () => {
        if (!this.formData.length) {
          this.$u.toast('请添加存档信息！')
          return Promise.reject('请添加存档信息！')
        }
        return Promise.resolve()
      })
    },
    // 点击提交
    async onSubmit() {
      await this.$refs.form.validate()
			var _this = this
			const model = {
			  ...this.model,
			  details: this.formData,
			}
      const res = await edit(model)
      if (res.success) {
				this.isSubmit = true
				this.$refs.uToast.show({
					message: '提交成功',
					type: 'success',
					complete () {
						_this.onAudit()
					}
				})
      } else {
        this.$refs.uToast.show({
          message: res.message,
          type: 'error',
        })
      }
    },
    onAudit() {
      if (!this.isSubmit) {
        uni.showToast({
          title: '请完善表单后审核',
          icon: 'none',
        })
        return false
      }
      var that = this
      uni.navigateTo({
        url: '/pages/synergy/erpProjectArchiveForm' + `?item=${encodeURIComponent(JSON.stringify(this.modelForm).replace(/%/g, '%25'))}`,
        success: function (data) {
          // 通过eventChannel向被打开页面传送数据
          var params = {
            nodeObj: encodeURIComponent(JSON.stringify(that.nodeObj).replace(/%/g, '%25')),
            tabvalue: that.tabvalue,
          }
          data.eventChannel.emit('sendMessage', params)
        },
        fail: function (err) {
          this.$refs.uToast.show({
            message: '请联系管理员配置',
            type: 'error',
          })
        },
      })
    }
  }
}
</script>
  
  <style scoped lang="scss">
@import url('@/assets/inputStyle.scss');
.trip-form-data {
  ::v-deep {
    .u-form-item__body {
      padding-top: 2px;
      padding-bottom: 2px;
    }
  }
}
.checkbox-item {
  display: flex;
  align-items: center;
}
</style>
  